#include "ground.h"
#include "../framework.h"

Vertexf Ground::vertices[] = { 	Vertexf(-0.5f,-0.5f),Vertexf(0.5f,-0.5f),
								Vertexf(0.5f,0.5f),Vertexf(-0.5f,0.5f) };

const unsigned int Ground::nVertices = 4;

Ground::Ground(Rectangle rec)
	:	SceneObject(rec) , Solid(rec,true){
	this->objVertices.vertices = vertices;
	this->objVertices.nVertices = nVertices;
}

Ground::~Ground(){

}

void Ground::draw(){
	Framework& fr = Framework::instance();
	Colorf old = fr.pipeline.getFillColor();
	fr.pipeline.pushMatrix();
		fr.pipeline.translate(this->dimensions.centerX(),this->dimensions.centerY());
		fr.pipeline.escale(this->dimensions.width(),this->dimensions.height());
		fr.pipeline.setFillColor(Colorf(0.31f,0.31f,0.31f));
		fr.pipeline.draw(Pipeline::POLYGON,this->objVertices.vertices,this->objVertices.nVertices);
	fr.pipeline.popMatrix();
	fr.pipeline.setFillColor(old);
}
